#ifndef TFC_DEF_H_INC
#define TFC_DEF_H_INC

typedef unsigned char BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long DWORD;

#define TRUE 		1
#define FALSE		0
#define __min(a, b)	((a)>(b)?(b):(a))
#define __max(a, b)	((a)>(b)?(a):(b))
#define MMD(v,m,d)	(((v)/(d))*(m)+(((v)%(d))*(m)+(d)/2)/(d))

#define LOBYTE(w) 	(BYTE)((w)&0x00FF)
#define HIBYTE(w) 	(BYTE)(((w)>>8)&0x00FF)
#define LOWORD(dw) 	(WORD)((dw)&0x0000FFFF)
#define HIWORD(dw) 	(WORD)(((dw)>>16)&0x0000FFFF)

#define DS_TIME			0.0001f
#define MAX_COUNT 		0xFFFFFFFF
#define	SECOND(s) 		((s)%60)
#define	MINUTE(s) 		(((s)/60)%60)
#define	HOUR(s) 		(((s)/3600)%24)
#define	HOURS(s) 		((s)/3600)
#define	DAYS(s) 		((s)/86400)

#endif
